<?php 
/**
 * 
 */
 class Mvideo extends CI_Model
 {
 	
 	public function __construct()
 	{
 		# code...
 		parent::__construct();
 		$this->load->database();
 	}
 	public function getTopVideo($limit) {
 		$result=$this->db->query("SELECT video.idVideo,video.idArtist,video.strFileName,video.strExtraArtist,video.strPath,artist.strArtist 
 			FROM video 
 			LEFT JOIN artist ON CONVERT(video.idArtist USING utf8)=CONVERT(artist.idArtist USING utf8) ORDER BY video.iRating DESC LIMIT 0, $limit" );
 		return $result->result_array();
 	}
 	public function getVideo($id) {
 		$result=$this->db->query("SELECT  video.idVideo,video.idAlbum,video.idGenre,video.idTheme,video.idArtist,video.strFileName,video.strExtraArtist,video.strPath,artist.strArtist ,theme.strTheme,genre.strGenre,album.strNameAlbum
 			FROM video 
 			LEFT JOIN album ON CONVERT(video.idAlbum USING utf8) =CONVERT(album.idAlbum USING utf8)
			LEFT JOIN artist ON CONVERT(video.idArtist USING utf8)=CONVERT(artist.idArtist USING utf8)
			LEFT JOIN theme ON CONVERT(video.idTheme USING utf8)=CONVERT(theme.idTheme USING utf8)
			LEFT JOIN genre ON CONVERT(video.idGenre USING utf8)=CONVERT(genre.idGenre USING utf8)
			WHERE idVideo LIKE '$id'
			 ");
 		return $result->result_array(); 
 	}
 } ?>